tests: Add a test-abi
authorColin Walters <walters@verbum.org>
Wed, 23 Mar 2016 19:18:27 +0000 (15:18 -0400)
committerColin Walters (automation) <walters+githubbot@verbum.org>
Thu, 24 Mar 2016 16:23:12 +0000 (16:23 +0000)
This would have caught a potential ABI regression in
https://bugzilla.gnome.org/show_bug.cgi?id=764056
(If we ran this test while building `--without-libarchive`)

Pull request: #218
Approved by: jlebon

Makefile-tests.am
tests/test-abi.sh [new file with mode: 0755]

index 9f359ad82999c70eae81e2aaa96f4d79af83c03b..50c714a990f8ace318e9d27cae3edc58af03092c 100644 (file)
@@ -23,8 +23,12 @@ include $(top_srcdir)/buildutil/glib-tap.mk
 # include the builddir in $PATH so we find our just-built ostree
 # binary.
 TESTS_ENVIRONMENT += OT_TESTS_DEBUG=1 \
+       SRCDIR=$$(cd $(top_srcdir) && pwd) \
+       BUILDDIR=$$(cd $(top_builddir) && pwd) \
        PATH=$$(cd $(top_builddir) && pwd):$${PATH}
 
+uninstalled_test_scripts = tests/test-abi.sh
+
 test_scripts = \
        tests/test-basic.sh \
        tests/test-pull-subpath.sh \
diff --git a/tests/test-abi.sh b/tests/test-abi.sh
new file mode 100755 (executable)
index 0000000..a49f8d4
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+#
+# Copyright (C) 2016 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -euo pipefail
+
+echo '1..1'
+
+grep ' ostree_[A-Za-z0-9_]*;' ${SRCDIR}/src/libostree/libostree.sym | sed -e 's,^ *\([A-Za-z0-9_]*\);,\1,' | sort -u > expected-symbols.txt
+eu-readelf -a ${BUILDDIR}/.libs/libostree-1.so | grep 'FUNC.*GLOBAL.*DEFAULT.*@@LIBOSTREE_' | sed -e 's,^.* \(ostree_[A-Za-z0-9_]*\)@@LIBOSTREE_[0-9_.]*,\1,' |sort -u > found-symbols.txt
+diff -u expected-symbols.txt found-symbols.txt
+
+echo 'ok'